# -*- coding: utf-8 -*-
import scrapy
from ..items import DoubanItem

class DoudouSpider(scrapy.Spider):
    name = 'doudou'
    allowed_domains = ['douban.com']
    def start_requests(self):
        urls = {
            'https://movie.douban.com/',
        }
        for url in urls:
            yield scrapy.Request(url=url, callback=self.parse)

    def parse(self, response):
        title = response.css("div.entry-header h1::text").extract_first()
        item = DoubanItem(name=title, url=response._url)
        yield item

